﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMES.IServices;
using MyMES.Dto;
using VOL.Core.Utilities.Response;
using VOL.Entity.DomainModels;
using System.Threading.Tasks;

namespace VOL.WebApi.Controllers.WorkFixtureManagement
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TypeSetupController : ControllerBase
    {
        private readonly ITypeSetupService _typeSetupService;

        public TypeSetupController(ITypeSetupService typeSetupService)
        {
            _typeSetupService = typeSetupService;
        }

        /// <summary>
        /// 添加类型设置
        /// </summary>
        /// <param name="typeSetup">类型设置实体</param>
        /// <returns>操作结果</returns>
        [HttpPost]
        public Task<WebResponseContent> AddTypeSetup([FromBody] TypeSetup typeSetup)
        {
            return _typeSetupService.AddTypeSetup(typeSetup);
        }

        /// <summary>
        /// 获取类型设置列表
        /// </summary>
        /// <param name="dto">查询条件</param>
        /// <returns>操作结果</returns>
        [HttpPost]
        public Task<WebResponseContent> GetTypeSetup([FromBody] GetTypeSetupDTO dto)
        {
            return _typeSetupService.GetTypeSetup(dto);
        }

        /// <summary>
        /// 更新类型设置
        /// </summary>
        /// <param name="typeSetup">类型设置实体</param>
        /// <returns>操作结果</returns>
        [HttpPost]
        public Task<WebResponseContent> UpdTypeSetup([FromBody] TypeSetup typeSetup)
        {
            return _typeSetupService.UpdTypeSetup(typeSetup);
        }

        /// <summary>
        /// 删除类型设置
        /// </summary>
        /// <param name="id">类型编码</param>
        /// <returns>操作结果</returns>
        [HttpPost]
        public Task<WebResponseContent> RemTypeSetup(string id)
        {
            return _typeSetupService.RemTypeSetup(id);
        }
    }
}
